import java.util.Scanner;

class Login{
    public String name="admin";
    public String passsWord="123456";

    public void logIn(String name, String passWord){
        if(!this.name.equals(name)){
            System.out.println("用户名错误");
        }
        if(!this.passsWord.equals(passWord)){
            System.out.println("密码错误");
        }
        System.out.println("登录成功");
    }
}
public class test {

    public static void func2()throws ArrayIndexOutOfBoundsException{
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        System.out.println(a);
    }

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        try {
            int[] array = {1,2,3,4};
            System.out.println(array[0]);
            int a = scanner.nextInt();
            System.out.println(a);
        }catch (NullPointerException e) {
            e.printStackTrace();
            System.out.println("捕获NullPointerException异常.....");
        }catch (ArrayIndexOutOfBoundsException e) {
            System.out.println("捕获ArrayIndexOutOfBoundsException异常.....");
        }finally {
            System.out.println("finally被执行了...");
            scanner.close();
        }
        System.out.println("after");
    }
    public static void main3(String[] args) {
        try{
            int[] arry = {1,23,3,4,56};
            System.out.println(arry[9]);
        }catch (ArrayIndexOutOfBoundsException e){
            e.printStackTrace();
            System.out.println("有这么长吗?你就访问");
        }
        System.out.println("after");
    }
    public static void func(){
        int[] arry = null;
        System.out.println(arry.length);
    }
    public static void main2(String[] args) {

        /*func();*/
           try{
               func();
           }catch (NullPointerException e){
               e.printStackTrace();
               System.out.println("出现空指针异常");
           }
        System.out.println("结束");
    }
    public static void main1(String[] args) {
       Login login = new Login();
       login.logIn("admin","123456");
    }
}
